{{#if (gt items.length 0)}}
  <ListCollection @items={{items}} class="consul-service-instance-list" as |item index|>
    <BlockSlot @name="header">
      <a href={{href-to routeName item.Service.Service item.Node.Node (or item.Service.ID item.Service.Service)}}>
        {{item.Service.ID}}
      </a>
    </BlockSlot>
    <BlockSlot @name="details">
      <ConsulExternalSource @item={{item.Service}} />
{{#let (reject-by 'ServiceID' '' item.Checks) as |checks|}}
  {{#let (service/instance-checks checks) as |serviceCheck| }}
    {{#if (eq serviceCheck.check 'empty') }}
      <dl class={{serviceCheck.check}}>
        <dt>
           <Tooltip>
            Service Checks
          </Tooltip>
        </dt>
        <dd>No service checks</dd>
      </dl>
    {{else}}
      {{#if (eq serviceCheck.count checks.length)}}
      <dl class={{serviceCheck.check}}>
        <dt>
          <Tooltip>
            Service Checks
          </Tooltip>
        </dt>
        <dd>All service checks {{serviceCheck.status}}</dd>
      </dl>
      {{else}}
      <dl class={{serviceCheck.check}}>
        <dt>
          <Tooltip>
            Service Checks
          </Tooltip>
        </dt>
        <dd>{{serviceCheck.count}}/{{checks.length}} service checks {{serviceCheck.status}}</dd>
      </dl>
      {{/if}}
    {{/if}}
  {{/let}}
{{/let}}
{{#let (filter-by 'ServiceID' '' item.Checks) as |checks|}}
  {{#let (service/instance-checks checks) as |nodeCheck| }}
    {{#if (eq nodeCheck.check 'empty') }}
      <dl class={{nodeCheck.check}}>
        <dt>
          <Tooltip>
            Node Checks
          </Tooltip>
        </dt>
        <dd>No node checks</dd>
      </dl>
    {{else}}
      {{#if (eq nodeCheck.count checks.length)}}
      <dl class={{nodeCheck.check}}>
        <dt>
          <Tooltip>
            Node Checks
          </Tooltip>
        </dt>
        <dd>All node checks {{nodeCheck.status}}</dd>
      </dl>
      {{else}}
      <dl class={{nodeCheck.check}}>
        <dt>
          <Tooltip>
            Node Checks
          </Tooltip>
        </dt>
        <dd>{{nodeCheck.count}}/{{checks.length}} node checks {{nodeCheck.status}}</dd>
      </dl>
      {{/if}}
    {{/if}}
  {{/let}}
{{/let}}
{{#if (get proxies item.Service.ID)}}
      <dl class="proxy">
        <dt>
          <Tooltip>
            Proxy
          </Tooltip>
        </dt>
        <dd data-test-proxy>
          connected with proxy
        </dd>
      </dl>
{{/if}}
{{#if (gt item.Node.Node.length 0)}}
      <dl class="node">
        <dt>
          <Tooltip>
            Node
          </Tooltip>
        </dt>
        <dd>
          <a href={{href-to 'dc.nodes.show' item.Node.Node}}>{{item.Node.Node}}</a>
        </dd>
      </dl>
{{/if}}
      <dl class="address" data-test-address>
        <dt>
          <Tooltip>
            IP Address and Port
          </Tooltip>
        </dt>
        <dd>
          {{#if (not-eq item.Service.Address '')}}
            {{item.Service.Address}}:{{item.Service.Port}}
          {{else}}
            {{item.Node.Address}}:{{item.Service.Port}}
          {{/if}}
        </dd>
      </dl>
      <TagList @item={{item.Service}} />
    </BlockSlot>
  </ListCollection>
{{/if}}